当前位置: 首页> 函数类别大全> round

round

对浮点数进行四舍五入
名称:round
分类:数学
所属语言:php
一句话介绍:对浮点数进行四舍五入。

定义和用法

round() 函数对浮点数进行四舍五入。

实例

<?php
echo(round(0.60));
echo(round(0.50));
echo(round(0.49));
echo(round(-4.40));
echo(round(-4.60));
?>

亲自试一试

语法

round(x,prec)
参数 描述
x 可选。规定要舍入的数字。
prec 可选。规定小数点后的位数。

说明

返回将 x 根据指定精度 prec (十进制小数点后数字的数目)进行四舍五入的结果。prec 也可以是负数或零(默认值)。

同类函数
  •  找出最大值 max

    max

    找出最大值
  •  将角度转换为弧度 deg2rad

    deg2rad

    将角度转换为弧度
  •  八进制转换为十进制 octdec

    octdec

    八进制转换为十进制
  •  判断是否为合法数值 is_nan

    is_nan

    判断是否为合法数值
  •  反正切 atan

    atan

    反正切
  •  十六进制转换为十进制 hexdec

    hexdec

    十六进制转换为十进制
  •  十进制转换为八进制 decoct

    decoct

    十进制转换为八进制
  •  双曲正切 tanh

    tanh

    双曲正切
热门文章